package com.ruoyi.web.controller.supervise;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.supervise.domain.CrCheckfileopinion;
import com.ruoyi.supervise.service.ICrCheckfileopinionService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 附件审核意见信息Controller
 * 
 * @author wtj
 * @date 2019-10-15
 */
@Controller
@RequestMapping("/supervise/CheckFileOpinion")
public class CrCheckfileopinionController extends BaseController
{
    private String prefix = "supervise/CheckFileOpinion";

    @Autowired
    private ICrCheckfileopinionService crCheckfileopinionService;

    @RequiresPermissions("supervise:CheckFileOpinion:view")
    @GetMapping()
    public String CheckFileOpinion()
    {
        return prefix + "/CheckFileOpinion";
    }

    /**
     * 查询附件审核意见信息列表
     */
    @RequiresPermissions("supervise:CheckFileOpinion:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(CrCheckfileopinion crCheckfileopinion)
    {
        startPage();
        List<CrCheckfileopinion> list = crCheckfileopinionService.selectCrCheckfileopinionList(crCheckfileopinion);
        return getDataTable(list);
    }

    /**
     * 导出附件审核意见信息列表
     */
    @RequiresPermissions("supervise:CheckFileOpinion:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(CrCheckfileopinion crCheckfileopinion)
    {
        List<CrCheckfileopinion> list = crCheckfileopinionService.selectCrCheckfileopinionList(crCheckfileopinion);
        ExcelUtil<CrCheckfileopinion> util = new ExcelUtil<CrCheckfileopinion>(CrCheckfileopinion.class);
        return util.exportExcel(list, "CheckFileOpinion");
    }

    /**
     * 新增附件审核意见信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存附件审核意见信息
     */
    @RequiresPermissions("supervise:CheckFileOpinion:add")
    @Log(title = "附件审核意见信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(CrCheckfileopinion crCheckfileopinion)
    {
        return toAjax(crCheckfileopinionService.insertCrCheckfileopinion(crCheckfileopinion));
    }

    /**
     * 修改附件审核意见信息
     */
    @GetMapping("/edit/{checkid}")
    public String edit(@PathVariable("checkid") String checkid, ModelMap mmap)
    {
        CrCheckfileopinion crCheckfileopinion = crCheckfileopinionService.selectCrCheckfileopinionById(checkid);
        mmap.put("crCheckfileopinion", crCheckfileopinion);
        return prefix + "/edit";
    }

    /**
     * 修改保存附件审核意见信息
     */
    @RequiresPermissions("supervise:CheckFileOpinion:edit")
    @Log(title = "附件审核意见信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(CrCheckfileopinion crCheckfileopinion)
    {
        return toAjax(crCheckfileopinionService.updateCrCheckfileopinion(crCheckfileopinion));
    }
    
    /**
     * 修改附件审核意见信息
     */
    @GetMapping("/detail/{checkid}")
    public String detail(@PathVariable("checkid") String checkid, ModelMap mmap)
    {
        CrCheckfileopinion crCheckfileopinion = crCheckfileopinionService.selectCrCheckfileopinionById(checkid);
        mmap.put("crCheckfileopinion", crCheckfileopinion);
        return prefix + "/detail";
    }

    /**
     * 删除附件审核意见信息
     */
    @RequiresPermissions("supervise:CheckFileOpinion:remove")
    @Log(title = "附件审核意见信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(crCheckfileopinionService.deleteCrCheckfileopinionByIds(ids));
    }
}
